package com.course.service.impl;

import com.course.dao.TeacherMapper;
import com.course.pojo.Teacher;
import com.course.service.TeacherService;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestParam;

@Service
public class TeacherServiceimpl implements TeacherService{
    private TeacherMapper teachermapper;

    @Override
    public int deleteByPrimaryKey(String teachername) {
        return teachermapper.deleteByPrimaryKey(teachername);
    }

    @Override
    public int insert(Teacher record) {
        return teachermapper.insert(record);
    }

    @Override
    public int insertSelective(Teacher record) {
        return teachermapper.insertSelective(record);
    }

    @Override
    public Teacher selectByPrimaryKey(String username) {
        return teachermapper.selectByPrimaryKey(teachername);
    }

    @Override
    public int updateByPrimaryKeySelective(Teacher record) {
        return teachermapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(Teacher record) {
        return teachermapper.updateByPrimaryKey(record);
    }

    @Override
    public String addTeacher(String teacherid,String password)
    {
        Teacher teacher = new Teacher();
        teacher.setTeacherid(teacherid);
        teacher.setPassword(password);
        int i = teacherMapper.updateByPrimaryKeySelective(teacher);
        if(i==1){
            return "200";
        }
        return "400";
    }

}
